package com.jihu.design.behavioral.chain;

import java.util.Objects;

/**
 * @author jihu
 * @date 2021/10/14
 */
public class Teacher {

    private String name;

    public Teacher (String name){
        this.name = name;
    }

    private Teacher next;//

    public Teacher setNext(Teacher next) {
        this.next = next;
        return this;
    }

    public Teacher getNext() {
        return next;
    }

    void handleRequest(){
        System.out.println(this.name+"正在处理......");

        if(Objects.nonNull(next)){
            next.handleRequest();
        }
    };

    public String getName() {
        return name;
    }

    public Teacher setName(String name) {
        this.name = name;
        return this;
    }
}
